package com.design.springboot.booksharing.service.impl;

import com.design.springboot.booksharing.bean.QueryWarp;
import com.design.springboot.booksharing.bean.User;
import com.design.springboot.booksharing.dao.UserDao;
import com.design.springboot.booksharing.service.UserService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 用户信息表(User)表服务实现类
 */
@Service("userService")
public class UserServiceImpl implements UserService {
    @Resource
    private UserDao userDao;

    @Override
    public Boolean saveUser(User user) {
        return userDao.saveUser(user) > 0;
    }

    @Override
    public Integer batchSaveUser(List<User> list) {
        return userDao.batchSaveUser(list);
    }

    @Override
    public Boolean deleteUser(Integer id) {
        return userDao.deleteUser(id) > 0;
    }

    @Override
    public Boolean updateUser(User user) {
        return userDao.updateUser(user) > 0;
    }

    @Override
    public User getUserById(Integer id) {
        return userDao.getUserById(id);
    }

    @Override
    public User getUserByAccount(String account) {
        return userDao.getUserByAccount(account);
    }

    @Override
    public List<User> listUser(QueryWarp<User> userQueryWarp) {
        return userDao.listUser(userQueryWarp);
    }
}
